package com.dhcc.DRGsHosp.facade.impl.assembler;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.dhcc.DRGsHosp.core.domain.MrqDictRules;
import com.dhcc.DRGsHosp.facade.dto.MrqDictRulesDTO;

public class MrqDictRulesAssembler {
	
	public static MrqDictRulesDTO toDTO(MrqDictRules mrqDictRules){
		if( mrqDictRules == null ){
			return null;
		}
		MrqDictRulesDTO mrqDictRulesDTO = new MrqDictRulesDTO();
		
		mrqDictRulesDTO.setRuleCode(mrqDictRules.getRuleCode());
		mrqDictRulesDTO.setDetailCode(mrqDictRules.getDetailCode());
		mrqDictRulesDTO.setScoreCode(mrqDictRules.getScoreCode());
		mrqDictRulesDTO.setWeightCode(mrqDictRules.getWeightCode());
		mrqDictRulesDTO.setRuleName(mrqDictRules.getRuleName());
		mrqDictRulesDTO.setRuleIntroduction(mrqDictRules.getRuleIntroduction());
		mrqDictRulesDTO.setCompleteFlag(mrqDictRules.getCompleteFlag());
		mrqDictRulesDTO.setMedicalRecordField(mrqDictRules.getMedicalRecordField());
		mrqDictRulesDTO.setValidFlag(mrqDictRules.getValidFlag());
		
		return mrqDictRulesDTO;
	}
	
	public static List<MrqDictRulesDTO>  toDTOs(Collection<MrqDictRules>  MrqDictRulesMore){
		if ( MrqDictRulesMore == null) {
			return null;
		}
		List<MrqDictRulesDTO> mdrdList = new ArrayList<MrqDictRulesDTO>();
		for (MrqDictRules mrqDictRules : MrqDictRulesMore) {
			mdrdList.add( toDTO(mrqDictRules) );
		}
		return mdrdList;		
	}
	
	public static MrqDictRules toEntity(MrqDictRulesDTO mrqDictRulesDTO){
		if( mrqDictRulesDTO == null ){
			return null;
		}
		MrqDictRules mrqDictRules = new MrqDictRules();
		
		mrqDictRules.setRuleCode(mrqDictRulesDTO.getRuleCode());
		mrqDictRules.setDetailCode(mrqDictRulesDTO.getDetailCode());
		mrqDictRules.setScoreCode(mrqDictRulesDTO.getScoreCode());
		mrqDictRules.setWeightCode(mrqDictRulesDTO.getWeightCode());
		mrqDictRules.setRuleName(mrqDictRulesDTO.getRuleName());
		mrqDictRules.setRuleIntroduction(mrqDictRulesDTO.getRuleIntroduction());
		mrqDictRules.setCompleteFlag(mrqDictRulesDTO.getCompleteFlag());
		mrqDictRules.setMedicalRecordField(mrqDictRulesDTO.getMedicalRecordField());
		mrqDictRules.setValidFlag(mrqDictRulesDTO.getValidFlag());
		
		return mrqDictRules;
	}
	
	public static List<MrqDictRules>  toEntities(Collection<MrqDictRulesDTO>  MrqDictRulesDTOMore){
		if ( MrqDictRulesDTOMore == null) {
			return null;
		}
		List<MrqDictRules> mdrList = new ArrayList<MrqDictRules>();
		for (MrqDictRulesDTO mrqDictRulesDTO : MrqDictRulesDTOMore) {
			mdrList.add( toEntity(mrqDictRulesDTO) );
		}
		return mdrList;		
	}
	
}
